﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sauces.Bussinees.Entities.Caja;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sauces.Repository.Mapping
{
   public  class FacturaMap:EntityTypeConfiguration<Factura>
    {
       public FacturaMap()
       {
           this.HasKey(t => t.Id);
           
           this.Property(p => p.Fecha).IsRequired();
           this.Property(p => p.SubTotal).HasPrecision(9,2).IsRequired();
           this.Property(p => p.Igv).HasPrecision(9, 2).IsRequired();
           this.Property(p => p.Total).HasPrecision(9, 2).IsRequired();
           
           this.ToTable("Factura");
           this.Property(p => p.Id).HasColumnName("IdFactura");

           this.HasRequired(f => f.Cliente).WithMany(c => c.Factura).HasForeignKey(f => f.IdCliente).WillCascadeOnDelete(false);


       }
    }
}
